﻿using Microsoft.AspNetCore.Mvc;
using SportsPlatform.Base;
using SportsPlatform.Dto.SportBusiness.EventsSession;
using SportsPlatform.Filters;
using SportsPlatform.Query.PermissionManagement.BaseQuery;
using SportsPlatform.Query.SportBusiness.EventsSession;
using SportsPlatform.SportBusiness.ISportBusiness;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SportsPlatform.Controllers
{
    /// <summary>
    /// 比赛项目场次控制器
    /// </summary>
    [ActionAuthorization]
    [Route("api/[controller]/[action]")]

    public class EventsSessionController : SportsPlatformControllerBase
    {
        private IEventsSessionService _eventsSessionService;
        /// <summary>
        /// 构造
        /// </summary>
        /// <param name="eventsSessionService"></param>
        public EventsSessionController(IEventsSessionService eventsSessionService)
        {
            _eventsSessionService = eventsSessionService;
        }

        /// <summary>
        /// 新增项目场次信息
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<BaseResultDto> AddEventsSessionInfo([FromBody] AddEventsSessionInfoQuery query)
        {
            return await _eventsSessionService.AddEventsSessionInfo(query);
        }

        /// <summary>
        /// 场次信息同步
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<BaseResultDto> EventsSessionInfoSynchronization([FromBody] List<EventsSessionInfoSynchronizationQuery> query)
        {
            return await _eventsSessionService.EventsSessionInfoSynchronization(query);
        }

        /// <summary>
        /// 更改项目场次信息
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<BaseResultDto> UpdteEventsSessionInfo([FromBody] UpdteEventsSessionInfoQuery query)
        {
            return await _eventsSessionService.UpdteEventsSessionInfo(query);
        }

        /// <summary>
        /// 删除项目场次信息
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<BaseResultDto> DeleteEventsSessionInfo([FromBody] DeleteOrGetModelQuery query)
        {
            return await _eventsSessionService.DeleteEventsSessionInfo(query);
        }

        /// <summary>
        /// 获取比赛项目场次树型数据
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResultListDto<EventsSessionTreeInfoDto>> GetEventsSessionTreeInfo([FromBody] GetEventsSessionTreeInfoQuery query)
        {
            return await _eventsSessionService.GetEventsSessionTreeInfo(query);
        }

        /// <summary>
        /// 获取比赛项目场次数据列表
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResultListDto<GetEventsSessionListDto>> GetEventsSessionList([FromBody] GetEventsSessionListQuery query)
        {
            return await _eventsSessionService.GetEventsSessionList(query);
        }
    }
}
